from _load import ANTHROPIC_API_KEY, OPENAI_API_KEY, SPECK_API_KEY
from speck import Prompt
from speck import OpenAI

openai = OpenAI(api_key=OPENAI_API_KEY, speck_api_key=SPECK_API_KEY)

# wow, wow2
prompts = openai.prompt.read_prompts("test.prompt")
initial_prompt = prompts["wow"].format(example=False)
kwargs = {
    "model": "gpt-4-1106-preview",
    "messages": initial_prompt,
    "temperature": 0.0,
    "metadata": {"agent": "hello", "user": "world"}
}
response = openai.chat.completions.create(**kwargs, stream=False)
print(response)

new_prompt = (initial_prompt
              .add(role="assistant", content=response.choices[0].message.content)
              .add(prompt=prompts["wow2"].format(example=True)))

kwargs = {
    "model": "gpt-4-1106-preview",
    "messages": new_prompt,
    "temperature": 0.0,
    "metadata": {"agent": "hello", "user": "world"}
}
response = openai.chat.completions.create(**kwargs, stream=False)
print(response)

# print("Stream:")
# for i in response:
#     print(i.choices[0].delta.content, end="")
